__author__ = 'Robin'
from django import forms
from django.forms import ModelForm,ValidationError
from datiandouweb.models import UserProfile,CommReg
from django.forms.models import modelform_factory
from django.http import QueryDict
import json


#####################personal info###########################

class UserProfileForm(ModelForm):
    def clean(self):
        #self.base_fields['workType'] =self.base_fields['half']
        #self.base_fields['userIntroduce'] =self.base_fields['introduce']
        cleaned_data = super(UserProfileForm, self).clean()
        print(self.data['User_work_type'])
        return cleaned_data

    class Meta:
        model = UserProfile
        fields = ('User_id','User_name', 'User_cellphone','User_email','User_introduce',
                  'User_introduce','User_work_type','Update_time')
        widgets = {
            'User_id': forms.TextInput
            }
####################################################


##########################cv upload###############

class FileUploadCvForm(forms.Form):
    cv_name = forms.CharField(widget=forms.TextInput,required=True,max_length=200)
    cv_language = forms.CharField(widget=forms.Select)
    is_open= forms.CharField(widget=forms.CheckboxInput)
    filename= forms.CharField(widget=forms.HiddenInput)




class TaskForm(forms.Form):
    content = forms.CharField(widget=forms.Textarea,required=True,max_length=400)
    startdatepic = forms.DateField()
    enddatepic = forms.DateField()
    city = forms.CharField(widget=forms.Select)
    language = forms.CharField(widget=forms.Select)
    type = forms.CharField(widget=forms.Select)
    price= forms.CharField(widget=forms.TextInput)
    account = forms.CharField(widget=forms.TextInput)
    email = forms.CharField(widget=forms.TextInput)
    cellphone = forms.CharField(widget=forms.TextInput)
    agree=forms.CharField(widget=forms.CheckboxInput)